<template>
  <div>
    <u-collapse v-if="versionList.length !=0">
      <u-collapse-item class="version-item" :title="item.versionName" v-for="(item, index) in versionList" :key="index">
        <u-parse :show-with-animation="true" :lazy-load="true" :selectable="true" :html="item.content" ></u-parse>
      </u-collapse-item>
    </u-collapse>
    <u-empty class="empty" v-else text="暂无版本信息" mode="list"></u-empty>
  </div>
</template>

<script>
import config from "@/config/config";
export default {
  data() {
    return {
      versionList: [],
      params: {
        pageNumber: 1,
        pageSize: 100,
        appType: config.appType,
        appOsType: '',
        versionState: 1
      },
    };
  },
  mounted() {
    const platform = uni.getSystemInfoSync().platform;
    /**
     * 获取是否是安卓
     */
    if (platform === "android") {
      this.params.appOsType = "Android";
    } else {
      this.params.appOsType = "IOS";
      // this.params.appOsType = "Android";
    }
    this.getVersionList();
  },
  methods: {
    // 默认只加载前100条版本更新记录
    async getVersionList(type) {
      let param = {
        data: this.params
      }
      this.$clApi.open.getAppVersionList(param).then(res => {
        this.versionList.push(...res.rows);
      })
    },
  },
};
</script>

<style scoped lang="scss">
.version-item{
    padding: 10rpx;
    background: #fff;
}

</style>
